#! /bin/bash
set -e

if [ "$CGO_ENABLED" = "1" ] 
then
    go test -race .
    find . -maxdepth 1 -mindepth 1 -type d \
      | egrep -v '^\.\/vendor|^.\/docs|^\.\/\..*' \
      | sed 's/.*/&\/.../g' \
      | xargs -I {} -P 4 go test -race {}
else
    go test .
    find . -maxdepth 1 -mindepth 1 -type d \
      | egrep -v '^\.\/vendor|^.\/docs|^\.\/\..*' \
      | sed 's/.*/&\/.../g' \
      | xargs -I {} -P 4 go test {}
fi
